home *** CD-ROM | disk | FTP | other *** search
/ AMIGA-CD 2 / Amiga-CD - Volume 2.iso / ungepackte_daten / 1993 / 6 / 02 / boopsi / imagetest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-01  |  2.4 KB  |  79 lines

  1. /* Programm: ImageTest.c
  2.  * Autor:    Rainer Zeitler
  3.  * Kreiert zwei Image-Objekte
  4.  * Compiler: SAS-C
  5.  * Aufruf:   lc -L ImageTest.c
  6.  */
  7.  
  8. #include <exec/types.h>
  9. #include <intuition/intuition.h>
  10. #include <intuition/gadgetclass.h>
  11. #include <intuition/imageclass.h>
  12. #include <clib/exec_protos.h>
  13. #include <clib/intuition_protos.h>
  14.  
  15. struct Library *IntuitionBase;
  16. struct Window  *MyWindow;
  17. struct Gadget *downgadget, *upgadget;
  18. struct Image *imageup, *imagedown;
  19. /* Parameter fürs Öffnen des Fensters */
  20. struct TagItem WindowTags[] = {
  21.   WA_Flags, WFLG_DEPTHGADGET | WFLG_DRAGBAR,
  22.   WA_IDCMP, 0, WA_Height, 200, WA_Width, 300,
  23.   WA_Title, (ULONG)"Image-Test", TAG_END,0
  24. };
  25. void main(void) {
  26.   struct DrawInfo *drawinfo;
  27.   /* Öffnen der Library (mind. V37) */
  28.   IntuitionBase=OpenLibrary("intuition.library",37);
  29.   if( IntuitionBase ) {
  30.     MyWindow = OpenWindowTagList(NULL,WindowTags);
  31.     if( MyWindow ) {
  32.       /* DrawInfo holen */
  33.       drawinfo=GetScreenDrawInfo(MyWindow->WScreen);
  34.       /* Einrichten des Images */
  35.       imageup=(struct Image *)NewObject( NULL,
  36.         "sysiclass", 
  37.         SYSIA_Size,  SYSISIZE_MEDRES, /* Hires */
  38.         SYSIA_Which, UPIMAGE,    /* Pfeil hoch */
  39.         SYSIA_DrawInfo, drawinfo,
  40.         TAG_END);
  41.       if( imageup ) {
  42.         imagedown=(struct Image *)NewObject( NULL,
  43.           "sysiclass",
  44.           SYSIA_Size,  SYSISIZE_MEDRES,
  45.           SYSIA_Which, DOWNIMAGE, /* Pfeil runter */
  46.           SYSIA_DrawInfo, drawinfo,
  47.           TAG_END);
  48.         if( imagedown ) {
  49.           downgadget=(struct Gadget *)NewObject(NULL,
  50.             "buttongclass", GA_IMAGE, imagedown,
  51.             GA_LEFT, 20, GA_TOP, 20, GA_ID, 1,
  52.             TAG_END );
  53.           if( downgadget ) {
  54.             upgadget=(struct Gadget *)NewObject(NULL,
  55.               "buttongclass", GA_IMAGE, imageup,
  56.               GA_LEFT, 50, GA_TOP, 20,
  57.               GA_ID,   2, GA_Previous, downgadget,
  58.               TAG_END );
  59.             if( upgadget ) {
  60.               AddGList( MyWindow, downgadget, -1 );
  61.               RefreshGList(downgadget,MyWindow,
  62.                                           NULL,-1);
  63.               /* Etwas warten */
  64.               Delay( 5 * 50 );
  65.               DisposeObject( upgadget );
  66.             }
  67.             DisposeObject( downgadget );
  68.           }
  69.           DisposeObject( imagedown );
  70.         }
  71.         DisposeObject( imageup );
  72.       }
  73.       FreeScreenDrawInfo(MyWindow->WScreen,drawinfo);
  74.       CloseWindow(MyWindow);
  75.     }
  76.     CloseLibrary(IntuitionBase);
  77.   }
  78. }
  79.